﻿using Essensoft.Paylink.Alipay.Notify;
using Essensoft.Paylink.WeChatPay.V3.Notify;
using StudyCompanion.Commons.Result;
using StudyCompanion.Dto.Order;
using StudyCompanion.Model.Order;

namespace StudyCompanion.IServices;

/// <summary>
///     订单服务
/// </summary>
public interface IOrderService
{
    /// <summary>
    ///     创建订单
    /// </summary>
    /// <param name="userId"></param>
    /// <param name="cardId"></param>
    /// <returns></returns>
    Task<Tuple<long?, string>> Create(long userId, long cardId);

    /// <summary>
    ///     创建订单并支付
    /// </summary>
    /// <param name="input"></param>
    /// <param name="userId"></param>
    /// <returns></returns>
    Task<CommonResult<AddOrderVo>> AddOrderAndPay(OrderAddDto input, long userId);

    /// <summary>
    ///     获取订单支付状态
    /// </summary>
    /// <param name="orderId"></param>
    /// <param name="userId"></param>
    /// <returns></returns>
    Task<CommonResult<int>> GetOrderTradeState(long orderId, long userId);

    /// <summary>
    ///     微信二维码扫码支付回调
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task WechatPayNotify(WeChatPayTransactionsNotify notify);

    /// <summary>
    ///     支付宝二维码扫码支付回调
    /// </summary>
    /// <param name="notify"></param>
    /// <returns></returns>
    Task AliPayNotify(AlipayTradePrecreateNotify notify);
}